package VN.EDU.IMIC.DEVELOPER.LETRONGKHANH.QLST.Models;

	import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Types;

import VN.EDU.IMIC.DEVELOPER.LETRONGKHANH.QLST.Entity.UserEntity;

	
	public class LoginModels {
		private Connection m_objConnection;
		private CallableStatement m_objCmst;

		public LoginModels(Connection objConnection) {
			m_objConnection = objConnection;
		}

		public boolean CheckElement(UserEntity objUser) throws SQLException {
			try {
				m_objCmst = m_objConnection
						.prepareCall("{? = call Y2015JC72USER(?,?)}");
				m_objCmst.registerOutParameter(1, Types.BIT);
				m_objCmst.setString("userName",objUser.getUserName());
				m_objCmst.setString("passWord",objUser.getPassWord());
				m_objCmst.execute();
			} catch (Exception ex) {
				throw ex;
			}
			return m_objCmst.getBoolean(1);
		}
	}

